using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration.Provider;

namespace Systepic.Projects
{
	/// <summary>
	/// Strongly typed collection of the providers
	/// </summary>
	public class ProjectsProviderCollection : ProviderCollection
	{
		/// <summary>
		/// Add a new ProjectsProvider to the 
		/// collection
		/// </summary>
		/// <param name="provider">The ProjectsProvider
		/// to add to the collection</param>
		public override void Add(ProviderBase provider)
		{
			// Make sure the provider exists
			if (provider == null)
				throw new ArgumentNullException(
					"The provder attempting to be added doesn't exist");
			// Type safety
			if (!(provider is ProjectsProvider))
				throw new ArgumentException(
					"The provider parameter must be of type BloggingProvider");
			base.Add(provider);
		}

		/// <summary>
		/// Get the projects provider by name.
		/// </summary>
		/// <param name="name">The name of the
		/// provider to obtain.</param>
		/// <returns>The project with the name
		/// specified.</returns>
		new public ProjectsProvider this[string name]
		{
			get { return (ProjectsProvider)base[name]; }
		}

		/// <summary>
		/// Copy the collection to an array.
		/// </summary>
		/// <param name="array">The location
		/// of the array to copy the collection</param>
		/// <param name="index">The index to copy
		/// the array at.</param>
		public void CopyTo(ProjectsProvider[] array, int index)
		{
			base.CopyTo(array, index);
		}
	}
}
